/*----------------------------------------------------------------------------------------
*
*  Copyright 2019, Gao Hai Hui, <fromzeropoint@126.com>.  All rights reserved.
*  https://gitee.com/helloworldghh/xoskit.git
*  Use of this source code is governed by a MIT license
*  that can be found in the License file.
*
----------------------------------------------------------------------------------------*/
#ifndef __BCFBE037_4A22_4a51_A872_C29CA1D99822__
#define __BCFBE037_4A22_4a51_A872_C29CA1D99822__


/////////////////////////////////////////////////////////////////////////////////////////
// 
namespace xos_box
{

    /////////////////////////////////////////////////////////////////////////////////////////
    // 
    // heart acceptor
    // 

    typedef int( * f_acceptor )( );

    /////////////////////////////////////////////////////////////////////////////////////////
    // 
    // heart beat interface
    // 
    class i_heart : public xos::i_release
    {
    protected:
        virtual ~i_heart(){}

    public:
        // 
        // set heart check interval : ms
        // 
        virtual int set_sys_check_interval( int32_t iSysCheckIntervalMS ) = 0;

        // 
        // add acceptor : ms
        // 
        virtual int add_acceptor( f_acceptor pAcceptor, int32_t iHeartIntervalMS ) = 0;

        // 
        // remove acceptor
        // 
        virtual int rem_acceptor( f_acceptor pAcceptor ) = 0;
        
        //
        // start/stop heart thread
        // 
        virtual int start_heart_thread() = 0;
        virtual int stop_heart_thread() = 0;
    };
}

#endif // __BCFBE037_4A22_4a51_A872_C29CA1D99822__
